<!DOCTYPE html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <title>微信JSAPI支付样例</title>
    <script type="text/javascript">
        //调用微信JS api 支付
        function jsApiCall()
        {
            WeixinJSBridge.invoke(
                    'getBrandWCPayRequest',
                    {
                        "appId":"${appId}",     //公众号名称，由商户传入
                        "timeStamp":"${timeStamp}",         //时间戳，自1970年以来的秒数
                        "nonceStr":"${nonceStr}", //随机串
                        "package":"${package}",
                        "signType":"MD5",         //微信签名方式：
                        "paySign":"${paySign}" //微信签名
                    },
                    function(res){
                        alert(res.err_code+res.err_desc+res.err_msg);
                    }
            );
        }

        function callPay()
        {
            if (typeof WeixinJSBridge == "undefined"){
                if( document.addEventListener ){
                    document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
                }else if (document.attachEvent){
                    document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                    document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
                }
            }else{
                jsApiCall();
            }
        }

        window.addEventListener("popstate", function(e) {
           alert(1);
        });
    </script>
</head>
<body>
<font color="#9ACD32"><b>0该笔订单支付金额为<span style="color:#f00;font-size:50px">1分</span>钱</b></font><br/><br/>
<div align="center">
    <button style="width:210px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer;  color:white;  font-size:16px;" type="button" onclick="callPay()" >立即支付</button>
</div>
</body>
</html>